Interface sjl.Function2
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface sjl.Function2

public interface Function2
extends Object
Defines the interface for functions object that takes two parameters. A function object is an object that can understand the perform(Object, Object) message. Function objects are used by many of the algorithms, ex: accumulate. You must implement the actual function object with code like this:
public class Sum implements Function2 {
    public Object perform(Object o1, Object o2) {
        return new Integer(((Integer)o1).intValue() + ((Integer)o2).intValue());
    }
}
This class will, when used with the accumulate function add together the integer value of each corresponding element in the two containers. The above example already exist as sjl.wrappers.FuncSumInteger.

Copyright © 1996 Finn Bock

See Also:
Function0, Function1

Method Index

 o perform(Object, Object)
This method is executed for each call to the function object.

Methods

 o perform
  public abstract Object perform(Object o1,
                                 Object o2)
This method is executed for each call to the function object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index